//从上到下打印二叉树

class Solution {
public:
    vector<int> levelOrder(TreeNode* root) {
        if(root == NULL)
            return {};
        queue<TreeNode *> q;
        vector<int> ret;
        q.push(root);
        while(!q.empty())
        {
            TreeNode* tmp = q.front();
            q.pop();
            ret.push_back(tmp->val);
            if(tmp->left) q.push(tmp->left);
            if(tmp->right) q.push(tmp->right);
        }
        return ret;
    }
};